fix(format): preserve model column dialect - #5926
Conversation
Signed-off-by: Andreas Fredhøi <andreas.fredhoi@fresio.no>
|
Sharing some findings from digging into this area. They support the approach here and suggest a way to extend it.
I prototyped this as a one-condition change to the hook in this PR. Swapping the columns name check for a policy lookup - extended to AUDIT/METRIC headers and nested kinds. It fixes the audits/physical_properties/time_data_type cases too, and Happy to open it as a follow-up on top of this, or hand it over if you'd rather fold it in. This PR's diagnosis and hook design are what it's built on. One process note independent of the approach: whatever lands is worth calling out as a behavior change in the release notes. This would be the third consecutive release that reformats T-SQL headers |
Description
Summary
columnsschema using the model's dialect.DATETIME2(6)for T-SQL and Fabric.Context
MODEL headers were recently changed to use SQLGlot's generic generator so that
T-SQL would not rewrite SQLMesh boolean properties such as
FALSEinto(1 = 0).However, the
columnsproperty contains dialect-specific data types. Renderingit with the generic generator changed
DATETIME2(6)intoTIMESTAMP(6)forT-SQL and Fabric models.
This change keeps the generic header behavior while rendering only the
columnsschema with the model dialect.Test Plan
tsqlandfabric.FALSE.tests/core/test_dialect.pysuite passes: 161 tests.Checklist
make styleand fixed any issuesmake fast-test)git commit -s) per the DCO